/* ======================================================================================== *\

		FILE:				Profiling.h
		AUTHOR:				Jack Hoxley

		DESCRIPTION:		Provides the declarations for utility functions used when
							profiling the main application.

		CHANGE:				5th May 2007
								Basic public interface laid out.

\* ======================================================================================== */
#ifndef INC_PROFILING_H
#define INC_PROFILING_H

// Include Standard Headers
// ------------------------

// Internal Headers
// ----------------

// Necessary Macro Definitions
// ---------------------------
#define WIDEN2(x) L ## x
#define WIDEN(x) WIDEN2(x)

#ifdef PROFILE
	// We only insert this sort of information into builds that
	// that request it.
	#define ENTER D3DUtils::ScopeProfiler sp( WIDEN(__FUNCTION__), __LINE__ )
	#define ENTER_NAMED(name) D3DUtils::ScopeProfile sp( name, __LINE__ )
#else
	// Define empty macro's for builds that don't want profiling/tracing
	// information to be included
	#define ENTER
	#define ENTER_NAMED(name)
#endif


namespace D3DUtils
{
	// Scope Profiler
	// --------------
	class ScopeProfiler
	{
		public:
			ScopeProfiler( WCHAR *Name, int Line );
			~ScopeProfiler( );

		private:
			ScopeProfiler( );
	};

	HRESULT InitializeTracing( );
	HRESULT TerminateTracing( );
	HRESULT TerminateTracing( WCHAR *TraceLogName );


	// Lock-step for profiling
	// -----------------------
	HRESULT RequestGPUSynchronization( );
}

#endif